package com.yk.ykmessagesdk.utils;

import android.util.Log;


/**
 * log 输出控制
 */
public class LogUtils {
    public static void logger(String logInfo){
        Config config = PayManager.getInstance().getConfig();
        if (config.isLogSwitch()){
//            Log.i(config.getLogTag(), logInfo);
            StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
            StringBuilder sb = new StringBuilder();
            String className = stackTrace[4].getClassName();
            sb.append(className.substring(className.lastIndexOf(".") + 1)).append(".")
                    .append(stackTrace[4].getMethodName()).append(" (").append(stackTrace[4].getFileName())
                    .append(":").append(stackTrace[4].getLineNumber()).append(")\n").append(logInfo);
            Log.i(config.getLogTag(), sb.toString());
        }

        Log.i("DREAM_PAY_SDK", logInfo);
    }
}
